# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ContainerAnalysis.V1alpha1.Model.VulnerabilityDetails do
  @moduledoc """
  Used by Occurrence to point to where the vulnerability exists and how to fix it.

  ## Attributes

  *   `cvssScore` (*type:* `number()`, *default:* `nil`) - Output only. The CVSS score of this vulnerability. CVSS score is on a scale of 0-10 where 0 indicates low severity and 10 indicates high severity.
  *   `cvssV2` (*type:* `GoogleApi.ContainerAnalysis.V1alpha1.Model.CVSS.t`, *default:* `nil`) - The CVSS v2 score of this vulnerability.
  *   `cvssV3` (*type:* `GoogleApi.ContainerAnalysis.V1alpha1.Model.CVSS.t`, *default:* `nil`) - The CVSS v3 score of this vulnerability.
  *   `cvssVersion` (*type:* `String.t`, *default:* `nil`) - Output only. CVSS version used to populate cvss_score and severity.
  *   `effectiveSeverity` (*type:* `String.t`, *default:* `nil`) - The distro assigned severity for this vulnerability when that is available and note provider assigned severity when distro has not yet assigned a severity for this vulnerability. When there are multiple package issues for this vulnerability, they can have different effective severities because some might come from the distro and some might come from installed language packs (e.g. Maven JARs or Go binaries). For this reason, it is advised to use the effective severity on the PackageIssue level, as this field may eventually be deprecated. In the case where multiple PackageIssues have different effective severities, the one set here will be the highest severity of any of the PackageIssues.
  *   `extraDetails` (*type:* `String.t`, *default:* `nil`) - Occurrence-specific extra details about the vulnerability.
  *   `packageIssue` (*type:* `list(GoogleApi.ContainerAnalysis.V1alpha1.Model.PackageIssue.t)`, *default:* `nil`) - The set of affected locations and their fixes (if available) within the associated resource.
  *   `severity` (*type:* `String.t`, *default:* `nil`) - Output only. The note provider assigned Severity of the vulnerability.
  *   `type` (*type:* `String.t`, *default:* `nil`) - The type of package; whether native or non native(ruby gems, node.js packages etc). This may be deprecated in the future because we can have multiple PackageIssues with different package types.
  *   `vexAssessment` (*type:* `GoogleApi.ContainerAnalysis.V1alpha1.Model.VexAssessment.t`, *default:* `nil`) - VexAssessment provides all publisher provided Vex information that is related to this vulnerability for this resource.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :cvssScore => number() | nil,
          :cvssV2 => GoogleApi.ContainerAnalysis.V1alpha1.Model.CVSS.t() | nil,
          :cvssV3 => GoogleApi.ContainerAnalysis.V1alpha1.Model.CVSS.t() | nil,
          :cvssVersion => String.t() | nil,
          :effectiveSeverity => String.t() | nil,
          :extraDetails => String.t() | nil,
          :packageIssue =>
            list(GoogleApi.ContainerAnalysis.V1alpha1.Model.PackageIssue.t()) | nil,
          :severity => String.t() | nil,
          :type => String.t() | nil,
          :vexAssessment => GoogleApi.ContainerAnalysis.V1alpha1.Model.VexAssessment.t() | nil
        }

  field(:cvssScore)
  field(:cvssV2, as: GoogleApi.ContainerAnalysis.V1alpha1.Model.CVSS)
  field(:cvssV3, as: GoogleApi.ContainerAnalysis.V1alpha1.Model.CVSS)
  field(:cvssVersion)
  field(:effectiveSeverity)
  field(:extraDetails)
  field(:packageIssue, as: GoogleApi.ContainerAnalysis.V1alpha1.Model.PackageIssue, type: :list)
  field(:severity)
  field(:type)
  field(:vexAssessment, as: GoogleApi.ContainerAnalysis.V1alpha1.Model.VexAssessment)
end

defimpl Poison.Decoder, for: GoogleApi.ContainerAnalysis.V1alpha1.Model.VulnerabilityDetails do
  def decode(value, options) do
    GoogleApi.ContainerAnalysis.V1alpha1.Model.VulnerabilityDetails.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.ContainerAnalysis.V1alpha1.Model.VulnerabilityDetails do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
